package gengine.common.packets;

import gengine.common.packets.client.ClientInfoPacket;
import gengine.common.packets.server.InitPacket;

/**
 * User: arseniy
 * Date: 26.12.11
 */
public class PacketFactory {
    public BasePacket create(PacketTypeEnum type) throws PacketParsingException {
        switch (type) {
            case ServerInitPacket:
                return new InitPacket();
            case ClientInfoPacket:
                return new ClientInfoPacket();
            case Message:
                return new MessagePacket();
            case Ping:
                return new PingPacket();
            default:throw new PacketParsingException("Unsupported packet type");
        }
    }
}
